package org.icec.iot.mqtt.server.plugin.auth;

import org.icec.iot.mqtt.server.common.auth.ClientBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class AuthDao {
	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Value("${mqtt-db.sql.query}")
	private String sql;
	public ClientBean check(String userName,String passwd) {
		ClientBean client= jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(ClientBean.class), userName,passwd);
		return client;
	}
}
